﻿<Controls:Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:Elysium.Controls;assembly=Elysium"
        xmlns:params="http://schemas.codeplex.com/elysium/params"
        xmlns:SynologyWebApi="clr-namespace:SynologyWebApi;assembly=SynologyWebApi"
        xmlns:local="clr-namespace:SynTorrent"
    
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Name="window"
        x:Class="SynTorrent.CreateDownloadWindow"

        Title="Add Download Task" Width="613" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Height="451.4" Loaded="window_Loaded" Topmost="True" ShowInTaskbar="False">
    <Controls:Window.DataContext>
        <SynologyWebApi:DownloadStationApi/>
    </Controls:Window.DataContext>

    <Controls:Window.Resources>
        <ResourceDictionary>
            <local:FilePathConverter x:Key="itemConverter"/>
        </ResourceDictionary>
    </Controls:Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="66"/>
            <RowDefinition Height="113"/>
            <RowDefinition/>
            <RowDefinition Height="76.8"/>
        </Grid.RowDefinitions>
        <TextBlock HorizontalAlignment="Left" Margin="31,50,0,0" TextWrapping="Wrap" Text="Download URL" VerticalAlignment="Top" Height="16" Width="78" Grid.Row="1"/>
        <TextBox x:Name="UrlTextBox" Margin="124,50,12,165" TextWrapping="Wrap" MinWidth="200" MinHeight="60" MaxHeight="170" TextChanged="UrlTextBox_TextChanged" Grid.Row="1" Grid.RowSpan="2"/>
        <Button x:Name="CreateButton" Content="Create" Margin="0,0,10,10" Click="CreateButton_Click" IsDefault="True" Grid.Row="3" IsEnabled="{Binding CanCreate, ElementName=window, Mode=OneWay}" Height="41" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="87"/>
        <StackPanel Margin="10,2,112,9" Orientation="Vertical" Grid.Row="3">
            <TextBlock x:Name="StatusMessageText" HorizontalAlignment="Left" TextWrapping="Wrap" Width="485" Text="{Binding ProgressMessage}" Height="29"/>
            <TextBlock x:Name="StatusErrorMessageText" HorizontalAlignment="Left" TextWrapping="Wrap" Width="485" Text="{Binding ErrorMessage}" Height="36" Foreground="#FFF05C25"/>
        </StackPanel>
        <Button x:Name="SpecifyFileButton" Content="Add Files..." HorizontalAlignment="Left" Margin="34,39,0,0" VerticalAlignment="Top" Width="85" Click="SpecifyFileButton_Click" Grid.Row="2" Height="31"/>
        <TextBlock HorizontalAlignment="Left" Margin="31,4,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="41" Width="384" Grid.Row="1"><Run Text="Enter an URL to create a download task. "/><LineBreak/><Run Text="Can be http:, https:, ftp:, ftps:, sftp:, magnet:, thunder:, flashget:, qqdl:. "/></TextBlock>
        <TextBlock HorizontalAlignment="Left" Margin="34,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Or specify local torrent files:" VerticalAlignment="Top" Height="25" Width="384"/>
        <ListBox x:Name="UploadFilesListBox" Margin="124,40,12,3" Grid.Row="2" BorderThickness="1">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Converter={StaticResource itemConverter}}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <ComboBox x:Name="AccountComboBox" HorizontalAlignment="Left" Margin="265,25,0,0" VerticalAlignment="Top" Width="330" Height="31" ItemTemplate="{DynamicResource DataTemplate1}" SelectionChanged="AccountComboBox_SelectionChanged">
            <ComboBox.Resources>
                <DataTemplate x:Key="DataTemplate1">
                    <TextBlock Text="{Binding ConnectionId}"/>
                </DataTemplate>
            </ComboBox.Resources>
        </ComboBox>
        <TextBlock HorizontalAlignment="Left" Margin="34,25,0,0" TextWrapping="Wrap" Text="Choose account for the new download:" VerticalAlignment="Top" Width="226" Height="31"/>

    </Grid>
</Controls:Window>
